home *** CD-ROM | disk | FTP | other *** search
- (************************************************************************)
-
- PROGRAM CARDEX (INPUT, OUTPUT) ;
-
- (*************************************************************************
-
- SOURCE FILE - CARDEX.PAS
-
- OBJECT FILE - CARDEX.COM
-
- DATA FILE - As per CARDEX.CFG or User Specified or
- default (CARDEX.DAT)
-
- CONFIGURATION FILE - CARDEX.CFG
- Specifies data file default and Mono/Color monitor
-
- THE PROGRAM IS A MEMORY HELD CARD INDEX ACCESSED VIA POINTER VARIABLES.
-
- WRITTEN BY AND PROPERTY OF MARK L. CARSON
-
- STARTED 7 JULY 1985 VERSION 1.2 - 1 MAY 1986
-
- *************************************************************************)
-
- CONST
- CompileDate = ' 1 MAY 86' ;
- Version = '1.2' ;
- NbrOfFields = 15 ;
- LineLen = 54 ;
- Blank = ' ' ;
- Blank2 = ' ' ;
- Blank3 = ' ' ;
- Blank4 = ' ' ;
- Blank5 = ' ' ;
- Blank15 = ' ' ;
- Blank19 = ' ' ;
- Blank26 = ' ' ;
- Blank54 = ' ' ;
-
- TYPE
- DataRecord = ^Node ;
- String19 = STRING[19] ;
- String54 = STRING[54] ;
- String12 = STRING[12] ;
- KeyType = (Regular, Return, Backspace, Escape, Cursor, F1) ;
- CursorType = (Home, Up, Left, Right, EndKey, Down) ;
- StringLen = STRING[LineLen] ;
-
- UNIT = RECORD
- Last : String19 ; (* Last name *)
- First : STRING[15] ; (* First name *)
- Area : STRING[3] ; (* Area code *)
- Fone1 : STRING[3] ; (* Phone Exchange *)
- Fone2 : STRING[4] ; (* Last 4 digits *)
- Addr : STRING[54] ; (* Street address *)
- City : STRING[26] ; (* City name *)
- State : STRING[2] ; (* 2 letter state *)
- ZIP : STRING[5] ; (* 5 digit ZIP *)
- ExtZIP : STRING[4] ; (* Extended ZIP *)
- L : ARRAY[1..5] OF STRING[54] ; (* Additional info *)
- END ;
-
- Node = RECORD
- PrevNode,
- NextNode : DataRecord ;
- CARD : UNIT ;
- END ;
-
- Coordinate = RECORD
- X, Y : INTEGER ;
- END ;
-
- FieldRec = RECORD
- X : 1..54 ; { column number }
- Y : 1..25 ; { line number }
- Len : 0..54 ; { field length }
- Str : String[54] ; { field's string }
- END ;
-
- VAR
- TempLast : String19 ;
- Ch, Ch2 : CHAR ;
- Pos : 1..LineLen ;
- Key : KeyType ;
- CursorDir : CursorType ;
- Esc, FunctionKey,
- Abort, Changed,
- BadKey, LoadFailed,
- JustStarted,
- InitialConfig,
- EntryGotoCard : BOOLEAN ;
- Monitor, Inkey,
- CharIn, Select,
- FormFeed : CHAR ;
- Top, Bottom,
- Counter, Nbr, Blue,
- Green, Grn, Red,
- Yellow, Blu, Dim : INTEGER ;
- FldNbr : 1..15 ;
- DefaultArea : STRING[3] ;
- Copyright : STRING[27] ;
- Access : STRING[28] ;
- InfoLine : STRING[80] ;
- DataFile, ConfigFile,
- DiskFile, MarkedFile : String12 ;
- Entry : String54 ;
- Copyrite : ARRAY [1..28] OF BYTE ;
- Fld, TempFld : ARRAY [1..NbrOfFields] OF FieldRec ;
- Prompt : ARRAY [1..NbrOfFields] OF STRING[30] ;
- ThisCard, TempCard : Unit ;
- Head, Last,
- Insert, Current,
- MarkedCard : DataRecord ;
- Config : TEXT ;
- RD : FILE OF UNIT ;
-
- (************************************************************************)
-
- { INCLUDE FILES SECTION }
-
- {$I TOOLS.INC}
- {$I COFFSCN.INC}
- {$I CSIZESCN.INC}
-
- (************************************************************************)
-
- PROCEDURE ClearBox ;
-
- BEGIN
- IF Monitor = 'M' THEN
- FOR Counter := 9 TO 17 DO
- BEGIN
- Window (1,1,80,25) ;
- GotoXY(13,Counter) ;
- Writeln (Blank+' ') ;
- END
- ELSE
- BEGIN
- Window (13,9,68,17) ;
- GotoXY(13,Counter) ;
- TextBackground (Blue) ;
- ClrScr ;
- WINDOW (1,1,80,25) ;
- END ;
- END ;
-
- (************************************************************************)
-
- FUNCTION GetKey (VAR FunctionKey : Boolean) : CHAR ;
-
- BEGIN
- Read (KBD,CharIn) ;
- IF (CharIn = #27) AND KeyPressed THEN (* it must be a function key *)
- BEGIN
- Read (KBD,CharIn) ;
- FunctionKey := TRUE ;
- END ELSE
- FunctionKey := FALSE ;
- GetKey := CharIn ;
- CharIn := Upcase(CharIn) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE UpString (VAR Word : String12) ;
-
- BEGIN
- FOR Counter := 1 TO Length(Word) DO Word[Counter] := UpCase(Word[Counter]) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE FunctionKeyInfo ;
-
- BEGIN
- NormVideo ; TextColor (White) ; TextBackground (Grn) ;
- GotoXY(72,5) ; Write (' M MARK ') ;
- GotoXY(72,6) ; Write (' T TRANS ') ;
- GotoXY(72,7) ; Write ('F1 CONFIG') ;
- GotoXY(71,20) ;
- Window (71,19,80,24) ;
- TextColor (White) ; TextBackGround(Grn) ;
- Write (' F2 ADD ') ;
- Write (' F4 GOTO ') ;
- Write (' F6 EDIT ') ;
- Write (' F8 KILL ') ;
- Write (' F9 PRINT ') ;
- Write ('F10 SAVE ') ;
- Window (1,1,80,25) ;
- TextBackGround (Black) ;
- GotoXY(14,9) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE DataToScreen ;
-
- BEGIN
- __COffScn (TRUE) ;
- Nbr := 1 ; NormVideo ;
- TextColor (White) ; TextBackground (Green) ;
- GotoXY(68,2) ; Write ('DataFile') ;
- GotoXY(68,3) ; ClrEOL ;
- GotoXY(68,3) ; Write (DataFile) ;
- TextColor (Blue) ; TextBackground (Blue) ;
- GotoXY(1,1) ; Write (' ') ;
- GotoXY(1,1) ;
- IF Current^.Card.Area <> DefaultArea THEN
- Write (Access,Current^.Card.Area,'-') ;
- Write (Current^.Card.Fone1,'-',Current^.Card.Fone2) ;
- TextColor (Dim) ; TextBackGround (Black) ;
- IF Monitor <> 'G' THEN LowVideo ;
- GotoXY(11,3) ; Writeln (Blank) ;
- GotoXY(11,3) ; Writeln (Current^.NextNode^.NextNode^.NextNode^.Card.Last) ;
- GotoXY(30,3) ; Writeln (Current^.NextNode^.NextNode^.NextNode^.Card.First) ;
- GotoXY(51,3) ; Writeln (Current^.NextNode^.NextNode^.NextNode^.Card.Area) ;
- GotoXY(56,3) ; Writeln (Current^.NextNode^.NextNode^.NextNode^.Card.Fone1) ;
- GotoXY(59,3) ; Writeln ('-',Current^.NextNode^.NextNode^.NextNode^.Card.Fone2) ;
- GotoXY(12,5) ; Writeln (Blank) ;
- GotoXY(12,5) ; Writeln (Current^.NextNode^.NextNode^.Card.Last) ;
- GotoXY(31,5) ; Writeln (Current^.NextNode^.NextNode^.Card.First) ;
- GotoXY(52,5) ; Writeln (Current^.NextNode^.NextNode^.Card.Area) ;
- GotoXY(57,5) ; Writeln (Current^.NextNode^.NextNode^.Card.Fone1) ;
- GotoXY(60,5) ; Writeln ('-',Current^.NextNode^.NextNode^.Card.Fone2) ;
- GotoXY(13,7) ; Writeln (Blank) ;
- GotoXY(13,7) ; Writeln (Current^.NextNode^.Card.Last) ;
- GotoXY(32,7) ; Writeln (Current^.NextNode^.Card.First) ;
- GotoXY(53,7) ; Writeln (Current^.NextNode^.Card.Area) ;
- GotoXY(58,7) ; Writeln (Current^.NextNode^.Card.Fone1) ;
- GotoXY(61,7) ; Writeln ('-',Current^.NextNode^.Card.Fone2) ;
- GotoXY(14,9) ;
-
- NormVideo ;
- TextBackGround(Blu) ; TextColor(Yellow) ;
- ClearBox ;
- GotoXY(14,9) ; Writeln (Current^.Card.Last) ;
- GotoXY(33,9) ; Writeln (Current^.Card.First) ;
- GotoXY(54,9) ; Writeln (Current^.Card.Area) ;
- GotoXY(59,9) ; Writeln (Current^.Card.Fone1) ;
- GotoXY(62,9) ; Writeln ('-',Current^.Card.Fone2) ;
- GotoXY(14,10) ; Writeln (Current^.Card.Addr) ;
- GotoXY(14,11) ; Writeln (Current^.Card.City) ;
- GotoXY(41,11) ; Writeln (Current^.Card.State) ;
- GotoXY(44,11) ; Writeln (Current^.Card.Zip) ;
- GotoXY(50,11) ; Writeln (Current^.Card.ExtZip) ;
- IF Current = MarkedCard THEN
- BEGIN GotoXY(60,12) ; Write ('(Marked)') ; END ;
- FOR Counter := 1 To 5 DO
- BEGIN GotoXY(14,Counter+12) ; Writeln (Current^.Card.L[Counter]) ; END ;
-
- TextColor (Dim) ; TextBackGround (Black) ;
- IF Monitor <> 'G' THEN LowVideo ;
- GotoXY(13,19) ; Writeln (Blank) ;
- GotoXY(13,19) ; Writeln (Current^.PrevNode^.Card.Last) ;
- GotoXY(32,19) ; Writeln (Current^.PrevNode^.Card.First) ;
- GotoXY(53,19) ; Writeln (Current^.PrevNode^.Card.Area) ;
- GotoXY(58,19) ; Writeln (Current^.PrevNode^.Card.Fone1) ;
- GotoXY(61,19) ; Writeln ('-',Current^.PrevNode^.Card.Fone2) ;
- GotoXY(12,21) ; Writeln (Blank) ;
- GotoXY(12,21) ; Writeln (Current^.PrevNode^.PrevNode^.Card.Last) ;
- GotoXY(31,21) ; Writeln (Current^.PrevNode^.PrevNode^.Card.First) ;
- GotoXY(52,21) ; Writeln (Current^.PrevNode^.PrevNode^.Card.Area) ;
- GotoXY(57,21) ; Writeln (Current^.PrevNode^.PrevNode^.Card.Fone1) ;
- GotoXY(60,21) ; Writeln ('-',Current^.PrevNode^.PrevNode^.Card.Fone2) ;
- GotoXY(11,23) ; Writeln (Blank) ;
- GotoXY(11,23) ; Writeln (Current^.PrevNode^.PrevNode^.PrevNode^.Card.Last) ;
- GotoXY(30,23) ; Writeln (Current^.PrevNode^.PrevNode^.PrevNode^.Card.First) ;
- GotoXY(51,23) ; Writeln (Current^.PrevNode^.PrevNode^.PrevNode^.Card.Area) ;
- GotoXY(56,23) ; Writeln (Current^.PrevNode^.PrevNode^.PrevNode^.Card.Fone1) ;
- GotoXY(59,23) ; Writeln ('-',Current^.PrevNode^.PrevNode^.PrevNode^.Card.Fone2) ;
- NormVideo ; TextBackground (Black) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Locate ;
-
- VAR
- ContinueSearch : BOOLEAN ;
- CurConcat, InsConcat : STRING[35] ;
-
- BEGIN
- ContinueSearch := TRUE ;
- Current := Head ;
- InsConcat := Insert^.Card.Last+'/'+Insert^.Card.First ;
- IF Current = Current^.NextNode THEN (* only one entry in list *)
- BEGIN
- Current^.PrevNode := Insert ;
- Current^.NextNode := Insert ;
- Insert^.PrevNode := Current ;
- Insert^.NextNode := Current ;
- IF InsConcat < Current^.Card.Last+'/'+Current^.Card.First
- THEN Head := Insert
- ELSE Last := Insert ;
- END ELSE (* more than one entry in list *)
- BEGIN
- IF InsConcat < Head^.Card.Last+'/'+Head^.Card.First THEN
- BEGIN
- ContinueSearch := FALSE ;
- Head^.PrevNode := Insert ;
- Last^.NextNode := Insert ;
- Insert^.PrevNode := Last ;
- Insert^.NextNode := Head ;
- Head := Insert ;
- END
- ELSE BEGIN
- WHILE ContinueSearch = TRUE DO
- BEGIN
- Current := Current^.NextNode ; (* advances pointer *)
- IF Current^.Card.Last+'/'+Current^.Card.First >= InsConcat
- THEN ContinueSearch := FALSE ;
- IF (InsConcat >= Current^.PrevNode^.Card.Last+'/'+
- Current^.PrevNode^.Card.First) AND
- (Current = Head) THEN ContinueSearch := FALSE ;
- END ;
- Insert^.PrevNode := Current^.PrevNode ;
- Insert^.NextNode := Current ;
- Current^.PrevNode^.NextNode := Insert ;
- Current^.PrevNode := Insert ;
- Current := Insert ;
- END ;
- END ;
- Current := Insert ;
- IF Current^.NextNode = Head THEN Last := Current ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Next ;
-
- BEGIN
- Current := Current^.NextNode ;
- DataToScreen ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Prev ;
-
- BEGIN
- Current := Current^.PrevNode ;
- DataToScreen ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Adv4 ;
-
- BEGIN
- Current := Current^.NextNode^.NextNode^.NextNode^.NextNode ;
- DataToScreen ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Back4 ;
-
- BEGIN
- Current := Current^.PrevNode^.PrevNode^.PrevNode^.PrevNode ;
- DataToScreen ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE HomeCard ;
-
- BEGIN
- Current := Head ;
- DataToScreen ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Delete ;
-
- VAR
- Entry : CHAR ;
- Goner : DataRecord ;
-
- BEGIN
- TextColor (White+Blink) ;
- GotoXY(71,22) ; Write (' KILL ') ;
- GotoXY(14,12) ; TextBackground (Red) ;
- TextColor (White) ; Write (' VERIFY YOU WISH TO ') ;
- TextColor (White + Blink) ; Write ('DELETE') ;
- TextColor (White) ; Write (' THIS CARD (Y/N) ') ;
- GotoXY (57,12) ;
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- REPEAT DELAY(200) UNTIL KeyPressed ;
- Read (KBD,Entry) ;
- __COffScn (TRUE) ;
- Entry := UpCase(Entry) ;
- CASE Entry OF
- 'Y' : BEGIN
- Goner := Current ;
- IF Current = Head THEN Head := Current^.NextNode ;
- IF Current = Last Then Last := Current^.PrevNode ;
- Current^.PrevNode^.NextNode := Current^.NextNode ;
- Current^.NextNode^.PrevNode := Current^.PrevNode ;
- Current := Current^.NextNode ;
- DataToScreen ;
- Changed := TRUE ;
- IF Goner^.PrevNode <> Goner THEN DISPOSE (Goner) ;
- END ;
- END ;
- TextBackGround(Blu) ;
- GotoXY(14,12) ; Write (Blank54) ;
- FunctionKeyInfo ;
- TextBackGround (Black) ;
- GotoXY(14,9) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE GotoCard ;
-
- LABEL 1, 2 ;
-
- VAR
- Entry : STRING[35] ;
- ContinueSearch,
- Stop : BOOLEAN ;
- FirstName : STRING[15] ;
- LastName : STRING[19] ;
- FirstPos : 0..35 ;
- Pos : 1..15 ;
-
- BEGIN
- TextColor (White + Blink) ;
- GotoXY(71,20) ; Write (' GOTO ') ;
- TextColor (Yellow) ;
- ContinueSearch := TRUE ;
- FirstName := ' ' ;
- LastName := ' ' ;
- FirstPos := 0 ; Pos := 1 ;
- IF EntryGotoCard THEN
- BEGIN
- Entry := ParamStr(2) ;
- EntryGotoCard := FALSE ;
- GotoXY(14,9) ; Window (14,9,68,12) ;
- END ELSE
- BEGIN
- ClearBox ;
- GotoXY(23,10) ; Write (' Enter name(s) to match') ;
- GotoXY(23,11) ; Write ('Last name or Last name/First name') ;
- GotoXY(23,12) ; Write (' IE: CARSON or CARSON/MARK') ;
- GotoXY(14,9) ; Window (14,9,68,12) ;
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- Readln (Entry) ;
- __COffScn (TRUE) ;
- END ;
- FOR Counter := 1 TO Length(Entry) DO Entry[Counter] := Upcase(Entry[Counter]) ;
- IF Entry <> '' THEN
- BEGIN
- Current := Head ;
- Counter := 1 ;
- Stop := FALSE ;
- WHILE Stop = FALSE DO
- BEGIN
- IF Entry[Counter] = '/' THEN
- BEGIN
- FirstPos := Counter + 1 ;
- Stop := TRUE ;
- END ;
- IF Counter = Length(Entry) THEN Stop := TRUE
- ELSE Counter := Counter + 1 ;
- END ;
- IF FirstPos <> 0 THEN
- BEGIN
- FOR Counter := 1 TO FirstPos-2 DO
- LastName[Counter] := Entry[Counter] ;
- FOR Counter := FirstPos TO Length(Entry) DO
- BEGIN
- FirstName[Pos] := Entry[Counter] ;
- Pos := Pos + 1 ;
- END ;
- END ELSE LastName := Entry ;
- Window (1,1,80,25) ;
- IF LastName <= Current^.Card.Last THEN ContinueSearch := FALSE ;
- While ContinueSearch = TRUE DO
- BEGIN
- Current := Current^.NextNode ;
- IF LastName <= Current^.Card.Last THEN ContinueSearch := FALSE ;
- IF (LastName >= Current^.PrevNode^.Card.Last)
- AND (Current = Head) THEN ContinueSearch := FALSE ;
- END ;
- IF FirstPos <> 0 THEN
- WHILE (LastName = Current^.Card.Last) AND
- (FirstName > Current^.Card.First) DO Current := Current^.NextNode ;
- END ELSE ClearBox ;
- DataToScreen ;
- FunctionKeyInfo ;
- END ;
-
- (************************************************************************)
-
-
- PROCEDURE FileNameError ;
-
- VAR
- OK : BOOLEAN ;
-
- BEGIN
- GotoXY(1,25) ;
- TextColor (White+Blink) ; TextBackground (Red) ; ClrEOL ;
- GotoXY(1,25) ; Write (DataFile) ;
- TextColor (White) ; Write (' is NOT a legal file name - Enter new file name : ') ;
- Read (DataFile) ;
- ASSIGN (RD,DataFile) ;
- {$I-} REWRITE (RD) ; {$I+}
- OK := (IOResult = 0) ;
- IF NOT OK THEN FileNameError ;
- TextBackground (Blu) ; GotoXY(1,25) ; ClrEOL ;
- GotoXY(1,25) ; TextColor (Yellow) ; Write (InfoLine) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE SaveToDisk ;
-
- LABEL 1 ;
-
- VAR
- OK : BOOLEAN ;
-
- BEGIN
- TextColor (White + Blink) ; TextBackground (Black) ;
- GotoXY(71,24) ; Write (' SAVE ') ;
- {$I-} RESET (RD) ; {$I+}
- OK := (IOResult = 0) ;
- IF NOT OK THEN
- BEGIN
- TextBackground (Red) ; GotoXY(1,25) ; ClrEOL ;
- GotoXY(1,25) ; Write (DataFile:12,' NOT ON LOGGED DRIVE ') ;
- TextColor (White) ;
- Write (#17,#196,#217,' TO SAVE ON CURRENT DRIVE OR Esc TO ABORT') ;
- Read (KBD,CharIn) ;
- IF CharIn = #27 THEN
- BEGIN
- GotoXY(1,25) ; ClrEol ;
- GotoXY(1,25) ; Write ('Aborted - File NOT Saved ') ;
- Delay (3000) ; TextBackground (Blu) ; GotoXY(1,25) ; ClrEol ;
- TextColor (Yellow) ; Write (InfoLine) ;
- GOTO 1 ;
- END ;
- TextBackGround (Blu) ; TextColor (Yellow) ;
- GotoXY(1,25) ; ClrEOL ;
- GotoXY(1,25) ; Write (InfoLine) ;
- END ;
- {$I-} CLOSE (RD) ; {$I+}
- ASSIGN (RD,DataFile) ;
- {$I-} REWRITE (RD) ; {$I+}
- OK := (IOResult = 0) ;
- IF NOT OK THEN FileNameError ;
- Current := Head ;
- WHILE Current <> Last DO
- BEGIN
- Write (RD,Current^.Card) ;
- Current := Current^.NextNode ;
- END ;
- Write (RD,Current^.Card) ;
- CLOSE (RD) ;
- Changed := FALSE ;
- 1 : FunctionKeyInfo ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE PrinterMode ;
-
- BEGIN
- NormVideo ; TextColor (White+Blink) ; TextBackground (Black) ;
- GotoXY(72,7) ; ClrEOL ; GotoXY(72,7) ; Write (' PRINTER') ;
- TextColor (White) ; GotoXY(80,25) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE PrintCard ;
-
- BEGIN
- PrinterMode ;
- WITH Current^.Card DO
- BEGIN
- Writeln (LST,Last,' ',First,' ',Area,' ',Fone1:3,'-',Fone2:4) ;
- Writeln (LST,Addr) ;
- Writeln (LST,City,' ',State,' ',ZIP,' ',ExtZip) ;
- Writeln (LST) ;
- FOR Counter := 1 TO 5 DO Writeln (LST,L[Counter]) ;
- Writeln (LST) ; Writeln (LST) ; Writeln (LST) ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE PrintLabel ;
-
- VAR
- Temp : STRING[15] ;
- Pos : INTEGER ;
-
- BEGIN
- PrinterMode ;
- WITH Current^.Card DO
- BEGIN
- Pos := 15 ;
- Temp := '' ;
- WHILE First[Pos] < #48 DO Pos := Pos - 1 ;
- Temp := Copy (First,1,Pos) ;
- Writeln (LST,Temp,' ',Last) ;
- Writeln (LST,Addr) ;
- Pos := 26 ;
- Temp := '' ;
- WHILE City[Pos] < #48 DO Pos := Pos - 1 ;
- Temp := Copy (City,1,Pos) ;
- Writeln (LST,Temp,' ',State,' ',ZIP,' ',ExtZip) ;
- Writeln (LST) ; Writeln (LST) ; Writeln (LST) ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE PrintAll (Format : CHAR) ;
-
- VAR
- Continue : BOOLEAN ;
- FormatName : STRING [6] ;
-
- BEGIN
- IF Format = 'L' THEN FormatName := 'LABEL ' ELSE FormatName := 'CARD ' ;
- GotoXY(71,20) ; Window (71,19,80,24) ;
- Write (' PRINTING ') ;
- Write (' ALL ITEMS') ;
- Write (' IN ',FormatName) ;
- Write (' FORMAT ') ;
- TextColor (White + Blink) ;
- Write (' Esc TO ') ;
- Write (' ABORT ') ;
- Window (1,1,80,25) ;
- TextColor (White) ;
- GotoXY(14,9) ;
- Current := Head ;
- Continue := TRUE ;
- WHILE Continue = TRUE DO
- BEGIN
- IF Format = 'L' THEN PrintLabel ELSE PrintCard ;
- IF KeyPressed THEN
- BEGIN
- Read (KBD,CharIn) ;
- IF CharIn = #27 THEN Continue := False ;
- END ;
- IF Current = Last THEN Continue := FALSE ;
- Current := Current^.NextNode ;
- END ;
- Current := Head ;
- DataToScreen ;
- FunctionKeyInfo ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE GetFunctionKey ;
-
- BEGIN
- Key := Cursor ;
- CASE Ch2 OF
- #71 : CursorDir := Home ;
- #72 : CursorDir := Up ;
- #75 : CursorDir := Left ;
- #77 : CursorDir := Right ;
- #79 : CursorDir := EndKey ;
- #80 : CursorDir := Down ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE KeyCheck ;
-
- BEGIN
- Ch2 := #32 ;
- IF ((Ch = #27) AND KeyPressed) THEN
- BEGIN
- Read (KBD,Ch2) ;
- IF Ch2 IN [#71..#81] THEN GetFunctionKey ;
- IF Ch2 = #59 THEN Key := F1 ;
- END
- ELSE Case Ch OF
- #8 : Key := Backspace;
- #13 : Key := Return ;
- #27 : Key := Escape ;
- ELSE Key := Regular ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Add ;
-
- VAR
- Mem : INTEGER ;
- OK : BOOLEAN ;
-
- BEGIN
- GotoXY(71,19) ; Write (' ADD ') ;
- ClearBox ;
- NEW (Insert) ;
- WITH Insert^.Card DO
- BEGIN
- Last := Blank19 ; First := Blank15 ; Area := Blank3 ;
- Fone1 := Blank3 ; Fone2 := Blank4 ; Addr := Blank54 ;
- City := Blank26 ; State := Blank2 ; Zip := Blank5 ;
- ExtZIP := Blank4 ;
- FOR Counter := 1 TO 5 DO L[Counter] := Blank54 ;
- END ;
- Mem := MemAvail ; Mem := Mem DIV 27 ;
- IF (Mem < 10) AND (Mem >= 0) THEN
- BEGIN
- TextColor (White+Blink) ; TextBackground (Red) ;
- GotoXY(13,13) ; Write (' WARNING ') ;
- TextColor (White) ; Write ('- Only ',Mem,' blank cards left in memory. ') ;
- TextColor (Yellow) ; TextBackground (Blue) ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE EDIT (EditStatus : CHAR);
-
-
-
- TYPE
- Code = (Continue, NextField, PrevField,
- FirstField, EndChange, EndSame) ;
-
- VAR
-
- FldNbr : 1..NbrOfFields ;
- ExitCode : Code ;
- Run, Reorder : BOOLEAN ;
-
- (************************************************************************)
-
- PROCEDURE Ed ;
-
- BEGIN
- GotoXY(1,4) ; ClrEOL ; GotoXY(1,4) ; Write (Prompt[FldNbr]) ;
- TextColor (Black) ; TextBackground (White) ;
- GotoXY (Fld[FldNbr].X,Fld[FldNbr].Y) ;
- FOR Counter := 1 TO (Fld[FldNbr].Len) DO Write (#32) ;
- GotoXY (Fld[FldNbr].X,Fld[FldNbr].Y) ; Write (Fld[FldNbr].Str) ;
- GotoXY (Fld[FldNbr].X,Fld[FldNbr].Y) ;
- Pos := 1 ;
- While ExitCode = Continue DO
- BEGIN
- Read (KBD,Ch) ;
- KeyCheck ;
- CASE Key OF
- Regular : BEGIN
- Write (Ch) ;
- Fld[FldNbr].Str[Pos] := Ch ;
- IF Pos < Fld[FldNbr].Len
- THEN Pos := Pos + 1
- ELSE GotoXY (Fld[FldNbr].X+Pos-1,Fld[FldNbr].Y) ;
- END ;
- Return : IF FldNbr <> NbrOfFields
- THEN ExitCode := NextField
- ELSE ExitCode := EndChange ;
- Backspace : IF Pos > 1 THEN
- BEGIN
- Pos := Pos - 1 ;
- GotoXY(Fld[FldNbr].X+Pos-1,Fld[FldNbr].Y) ;
- Fld[FldNbr].Str[Pos] := #32 ;
- Write (Fld[FldNbr].Str[Pos]) ;
- GotoXY(Fld[FldNbr].X+Pos-1,Fld[FldNbr].Y) ;
- END ELSE
- BEGIN
- Write (#7) ;
- END ;
- Cursor : CASE CursorDir OF
- Left : BEGIN
- IF Pos > 1
- THEN Pos := Pos - 1
- ELSE Write (#7) ;
- GotoXY(Fld[FldNbr].X+Pos-1,Fld[FldNbr].Y) ;
- END ;
- Right : BEGIN
- IF Pos < Fld[FldNbr].Len
- THEN Pos := Pos + 1
- ELSE Write (#7) ;
- GotoXY(Fld[FldNbr].X+Pos-1,Fld[FldNbr].Y) ;
- END ;
- Up : ExitCode := PrevField ;
- Down : ExitCode := NextField ;
- Home : ;
- EndKey : ExitCode := EndChange ;
- END ; { end case cursordir }
- Escape : ExitCode := EndSame ;
- END ; { end case key }
- END ; { end while exitcode }
- TextColor (Yellow) ; TextBackground (Blue) ;
- GotoXY (Fld[FldNbr].X,Fld[FldNbr].Y) ; Write (Fld[FldNbr].Str) ;
- END ; { end procedure edit }
-
- (************************************************************************)
-
- BEGIN
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- TextColor (White + Blink) ;
- TextBackGround (Black) ;
- IF EditStatus = 'E'
- THEN BEGIN
- GotoXY(71,21) ; Write (' EDIT ') ; ReOrder := FALSE ;
- Insert := Current ;
- END
- ELSE Add ;
- TextColor (Yellow) ; TextBackground (Blue) ;
- GotoXY(1,25) ; ClrEol ; GotoXY(1,25) ;
- Write (' ',#27,#26,' PREV/NEXT LETTER ',#18,' PREV/NEXT FIELD End DONE Esc ABORT ',#17,#196,#217,' NEXT FIELD') ;
- TextBackground (Blu) ; GotoXY(14,9) ;
- Window (14,9,68,17) ;
- ExitCode := Continue ;
- Run := TRUE ;
-
- Fld[1].Str := Blank19 ;
- Fld[2].Str := Blank15 ;
- Fld[3].Str := Blank3 ;
- Fld[4].Str := Blank3 ;
- Fld[5].Str := Blank4 ;
- Fld[6].Str := Blank54 ;
- Fld[7].Str := Blank26 ;
- Fld[8].Str := Blank2 ;
- Fld[9].Str := Blank5 ;
- Fld[10].Str := Blank4 ;
- FOR Counter := 1 TO 5 DO
- Fld[Counter+10].Str := Blank54 ;
-
- IF EditStatus = 'E' THEN WITH Insert^.Card DO
- BEGIN
- FOR Pos := 1 TO Length(Last) DO Fld[1].Str[Pos] := Last[Pos] ;
- FOR Pos := 1 TO Length(First) DO Fld[2].Str[Pos] := First[Pos] ;
- FOR Pos := 1 TO Length(Area) DO Fld[3].Str[Pos] := Area[Pos] ;
- FOR Pos := 1 TO Length(Fone1) DO Fld[4].Str[Pos] := Fone1[Pos] ;
- FOR Pos := 1 TO Length(Fone2) DO Fld[5].Str[Pos] := Fone2[Pos] ;
- FOR Pos := 1 TO Length(Addr) DO Fld[6].Str[Pos] := Addr[Pos] ;
- FOR Pos := 1 TO Length(City) DO Fld[7].Str[Pos] := City[Pos] ;
- FOR Pos := 1 TO Length(State) DO Fld[8].Str[Pos] := State[Pos] ;
- FOR Pos := 1 TO Length(ZIP) DO Fld[9].Str[Pos] := ZIP[Pos] ;
- FOR Pos := 1 TO Length(ExtZIP) DO Fld[10].Str[Pos] := ExtZIP[Pos] ;
- FOR Counter := 1 TO 5 DO
- FOR Pos := 1 TO Length(L[Counter]) DO
- Fld[Counter+10].Str[Pos] := L[Counter][Pos] ;
- END ELSE
- BEGIN
- Fld[3].Str := DefaultArea ;
- GotoXY(Fld[3].X,Fld[3].Y) ;
- Write (Fld[3].Str) ;
- END ;
-
- FldNbr := 1 ;
- Pos := 1 ;
-
- WHILE Run DO
- BEGIN
- CASE ExitCode OF
- Continue : Ed ;
- EndSame : Run := FALSE ;
- EndChange : BEGIN
- Run := FALSE ;
- WITH Insert^.Card DO
- BEGIN
- IF EditStatus = 'E' THEN
- IF Last <> Fld[1].Str THEN ReOrder := TRUE ;
- Last := Fld[1].Str ; First := Fld[2].Str ;
- Area := Fld[3].Str ; Fone1 := Fld[4].Str ;
- Fone2 := Fld[5].Str ; Addr := Fld[6].Str ;
- City := Fld[7].Str ; State := Fld[8].Str ;
- ZIP := Fld[9].Str ; ExtZIP := Fld[10].Str ;
- FOR FldNbr := 11 TO 15
- DO L[FldNbr-10] := Fld[FldNbr].Str ;
- FOR Counter := 1 TO Length(Last) DO
- BEGIN
- Last[Counter] := UpCase(Last[Counter]) ;
- First[Counter] := UpCase(First[Counter]) ;
- END ;
- END ;
- END ;
- NextField : BEGIN
- IF FldNbr < NbrOfFields THEN FldNbr := FldNbr + 1 ;
- ExitCode := Continue ;
- Ed ;
- END ;
- PrevField : BEGIN
- IF FldNbr > 1 THEN FldNbr := FldNbr - 1 ;
- ExitCode := Continue ;
- Ed ;
- END ;
- END ;
- END ;
- IF ReOrder = TRUE THEN
- BEGIN
- Current^.PrevNode^.NextNode := Current^.NextNode ;
- Current^.NextNode^.PrevNode := Current^.PrevNode ;
- IF Insert = Last THEN Last := Current^.PrevNode ;
- IF Insert = Head THEN Head := Current^.NextNode ;
- Locate ;
- END ;
- IF (EditStatus = 'A') AND (Insert^.Card.Last > #33)
- THEN Locate
- ELSE IF EditStatus = 'A' THEN Dispose(Insert) ;
-
- IF (ExitCode = EndChange) AND (Reorder = FALSE) THEN Current := Insert ;
- Window (1,1,80,25) ;
- TextColor (Yellow) ; TextBackground (Blue) ;
- GotoXY(1,25) ; Write (InfoLine) ;
- DataToScreen ;
- FunctionKeyInfo ;
- __COffScn (TRUE) ;
- IF ExitCode <> EndSame THEN Changed := TRUE ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Screen ;
-
- CONST
- Row = 2 ;
- Column = 9 ;
- Len = 56 ;
- Tall = 9 ;
-
- VAR
- R, C, Counter, Pos, Offset : INTEGER ;
-
- BEGIN
- ClrScr ; NormVideo ; TextBackGround (Green) ; ClrScr ;
- TextBackGround(Blue) ; TextColor(Yellow) ; ClrEOL ;
- GotoXY(29,1) ; Writeln ('CARDEX by Carson Info Svcs ') ;
- TextBackGround(Black) ; TextColor(White) ;
- R := Row ; C := Column ;
-
- (* next three cards *)
- LowVideo ;
- FOR Counter := 0 TO 2 DO
- BEGIN
- GotoXY(C+Counter,R+Counter*2) ;
- Write (CHR(218)) ;
- FOR Pos := 1 TO Len DO Write (CHR(196)) ;
- Writeln (CHR(191)) ;
- GotoXY(C+Counter+1,R+Counter*2+1) ;
- FOR Pos := 1 TO Len DO Write (' ') ;
- GotoXY(C+Counter+Pos+1,R+Counter*2+1) ;
- Writeln (CHR(179)) ;
- FOR Pos := 1 TO 5 DO
- BEGIN GotoXY(C+Counter,R+Counter*2+Pos) ; Writeln (CHR(179)) ; END ;
- END ;
-
- (* current card *)
- NormVideo ;
- TextBackground(Blu) ;
- ClearBox ;
- GotoXY(C+3,R+6) ; Write (CHR(201)) ; FOR Pos := 1 TO Len DO Write (CHR(205)) ;
- Writeln (CHR(187)) ;
- FOR Counter := 1 TO Tall DO
- BEGIN
- GotoXY(C+3,R+Counter+6) ; Writeln (CHR(186)) ;
- GotoXY(C+3+Len+1,R+Counter+6) ; Writeln (CHR(186)) ;
- END ;
- GotoXY(C+3,R+6+Tall+1) ; Write (CHR(200)) ;
- FOR Pos := 1 TO Len DO Write (CHR(205)) ; Writeln (CHR(188)) ;
-
- (* previous three cards *)
- LowVideo ;
- FOR Counter := 1 TO 3 DO
- BEGIN
- GotoXY(C+3-Counter,R+7+Tall+Counter*2) ;
- Write (CHR(192)) ;
- FOR Pos := 1 TO Len DO Write (CHR(196)) ;
- Writeln (CHR(217)) ;
- GotoXY(C+4-Counter,R+6+Tall+Counter*2) ;
- FOR Pos := 1 TO Len DO Write (' ') ;
- GotoXY(C+4-Counter+Pos,R+6+Tall+Counter*2) ;
- Writeln (CHR(179)) ;
- FOR Pos := 0 TO 4 DO
- BEGIN GotoXY(C+3-Counter,R+6+Tall+Counter*2-Pos) ; Writeln (CHR(179)) ; END ;
- END ;
-
- (* knobs *)
- TextColor (White) ; TextBackGround (Black) ; LowVideo ;
- FOR Counter := 1 TO 2 DO
- BEGIN
- IF Counter = 1 THEN Offset := 2 ELSE Offset := Len + 19 ;
- GotoXY(Offset,R+6) ;
- Writeln (CHR(201),CHR(205),CHR(205),CHR(205),CHR(187)) ;
- GotoXY(Offset,R+7) ;
- Writeln (CHR(186),' ',CHR(24),' ',CHR(186)) ;
- FOR Pos := 1 TO 7 DO
- BEGIN
- GotoXY(Offset,R+7+Pos) ;
- Writeln (CHR(204),CHR(205),CHR(205),CHR(205),CHR(185)) ;
- END ;
- GotoXY(Offset,R+15) ;
- Writeln (CHR(186),' ',CHR(25),' ',CHR(186)) ;
- GotoXY(Offset,R+16) ;
- Writeln (CHR(200),CHR(205),CHR(205),CHR(205),CHR(188)) ;
- IF Counter = 1 THEN Offset := 2 ELSE Offset := Len + C ;
- GotoXY(Offset+5,R+9) ;
- FOR Pos := 1 TO 5 DO Write (CHR(205)) ;
- FOR Pos := 1 TO 4 DO
- BEGIN GotoXY(Offset+5,R+9+Pos) ; Write (' ') ; END ;
- GotoXY(Offset+5,R+13) ;
- FOR Pos := 1 TO 5 DO Write (CHR(205)) ;
- END ;
-
- (* cusor control information *)
- GotoXY(1,25) ;
- NormVideo ; TextBackGround(Blue) ; TextColor(Yellow) ;
- ClrEOL ; GotoXY(1,25) ;
- Write (InfoLine) ;
- TextColor (White) ;
- TextBackground (Black) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE DiskToMemory ;
-
- LABEL 1 ;
-
- VAR
- Mem : INTEGER ;
-
- BEGIN
- TextBackGround (Red) ; TextColor (White+Blink) ;
- GotoXY(1,25) ; ClrEOL ; GotoXY(1,25) ;
- Mem := MemAvail ; Mem := Mem DIV 27 ;
- IF (Mem < FileSize(RD)) AND (Mem >= 0) THEN
- BEGIN
- Write (' LOAD FAILED') ; TextColor (White) ;
- Write (' - Available memory is not large enough to load data file') ;
- DELAY (4000) ; LoadFailed := TRUE ; GOTO 1 ;
- END ;
- TextColor (White+Blink) ;
- Write (' WAIT ') ; TextColor (White) ;
- Write ('- Reading data from disk ') ;
- RESET (RD) ;
- IF NOT EOF (RD) THEN Read (RD,ThisCard) ;
-
- NEW (Insert) ;
-
- Insert^.Card := ThisCard ;
- Insert^.PrevNode := Insert ;
- Insert^.NextNode := Insert ;
- Head := Insert ;
- Current := Insert ;
- While NOT EOF (RD) DO
- BEGIN
- Read (RD,ThisCard) ;
- NEW (Insert) ;
- Insert^.Card := ThisCard ;
- Insert^.PrevNode := Current ;
- Insert^.NextNode := Head ;
- Head^.PrevNode := Insert ;
- Current^.NextNode := Insert ;
- Current := Insert ;
- Last := Insert ;
- END ;
- CLOSE (RD) ;
- 1 : END ;
-
- (************************************************************************)
-
- PROCEDURE SetMonitor ;
-
- BEGIN
- CASE Monitor OF
- 'C' : BEGIN
- TextMode (C80) ;
- Top := 6 ; Bottom := 7 ;
- Blue := 1 ; Green := 2 ; Red := 4 ;
- Yellow := 14 ; Grn := 2 ; Dim := 15 ; Blu := 1
- END ;
- 'G' : BEGIN
- TextMode (C80) ;
- Top := 6 ; Bottom := 7 ;
- Blue := 1 ; Green := 2 ; Red := 4 ;
- Yellow := 15 ; Grn := 2 ; Dim := 5 ; Blu := 0 ;
- END
- ELSE BEGIN
- TextMode (BW80) ;
- Top := 12 ; Bottom := 13 ;
- Blue := 0 ; Green := 0 ; Red := 0 ;
- Yellow := 15 ; Grn := 0 ; Dim := 15 ; Blu := 0 ;
- END ;
- END ; (* END CASE Monitor *)
- END ;
-
- (************************************************************************)
-
- PROCEDURE AuthorsCard ;
-
- BEGIN
- ThisCard.Last := 'CARSON INFORMATION' ;
- ThisCard.First := 'SERVICES ' ;
- ThisCard.Area := '808' ;
- ThisCard.Fone1 := '595' ;
- ThisCard.Fone2 := '7119' ;
- ThisCard.Addr := '821-A Puunani Place ' ;
- ThisCard.City := 'Honolulu ' ;
- ThisCard.State := 'HI' ;
- ThisCard.Zip := '96817' ;
- ThisCard.ExtZip := ' ' ;
- ThisCard.L[1] := 'CARDEX by Carson Information Services is NOT a public' ;
- ThisCard.L[2] := 'domain program. If you did not purchase the copy you ' ;
- ThisCard.L[3] := 'are using, and find the program useful, you are ' ;
- ThisCard.L[4] := 'encouraged to send what you feel the program''s ' ;
- ThisCard.L[5] := 'value ($) to you is to : CARSON INFORMATION SERVICES.' ;
- TempCard := ThisCard ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE DataIn ;
-
- VAR
- OK : BOOLEAN ;
-
- BEGIN
- ASSIGN (RD,DataFile) ;
- {$I-} RESET (RD) ; {$I+}
- OK := (IOResult = 0) ;
- IF NOT OK THEN
- BEGIN
- NEW (Current) ;
- AuthorsCard ;
- Current^.Card := ThisCard ;
- Current^.PrevNode := Current ;
- Current^.NextNode := Current ;
- Head := Current ;
- Last := Current ;
- END ELSE
- DiskToMemory ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE Configure ;
-
- LABEL 1, 2 ;
-
- VAR
- Entry : CHAR ;
- Entry2 : String12 ;
- Entry3 : STRING[27] ;
- Cont, OK,
- FileChanged,
- AreaChanged,
- AccessChanged,
- ScreenChanged,
- PrinterChanged : BOOLEAN ;
- Mem, NbrOfCards : INTEGER ;
-
- BEGIN
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- Entry2 := '' ;
- ScreenChanged := FALSE ; AreaChanged := FALSE ;
- FileChanged := FALSE ; PrinterChanged := FALSE ;
- TextColor (White) ; TextBackground (Red) ;
- ClrScr ;
- FOR Counter := 1 TO 80 DO Write (#205) ;
- Writeln (' CARDEX by Carson Information Services') ;
- Writeln ;
- Writeln (' CONFIGURATION SET-UP') ;
- Writeln ;
- FOR Counter := 1 TO 80 DO Write (#205) ;
- GotoXY(2,8) ; Write ('OPTIONS') ;
- GotoXY(58,8) ; Write ('CURRENT DATA') ;
- IF JustStarted THEN GOTO 2 ;
- NbrOfCards := 1 ;
- Current := Head ;
- WHILE Cont DO
- BEGIN
- IF Current = Head^.PrevNode THEN Cont := FALSE
- ELSE BEGIN
- NbrOfCards := NbrOfCards + 1 ;
- Current := Current^.NextNode ;
- END ;
- END ;
- GotoXY(2,24) ; Write ('Number of cards in the current file - ',NbrOfCards) ;
-
- Mem := MemAvail ; Mem := Mem DIV 27 ;
- GotoXY(2,25) ; Write ('Available blank cards in memory - ',Mem) ;
-
- 2 : Gotoxy(2,10) ; Write ('Monitor : Color, Graphics, Monochrome (C/G/M) - ') ;
- GotoXY(58,10) ;
- CASE Monitor OF
- 'C' : Write ('Color') ;
- 'G' : Write ('Graphics') ;
- 'M' : Write ('Monochrome')
- ELSE Write ('Set up error') ;
- END ; {end CASE Monitor}
- GotoXY(50,10) ; Read (KBD,Entry) ; Entry := Upcase(Entry) ;
- IF Entry = #27 THEN GOTO 1 ;
- IF Entry <> #13 THEN
- BEGIN
- ScreenChanged := TRUE ;
- GotoXY(58,10) ; ClrEOL ;
- CASE Entry OF
- 'C' : Monitor := 'C' ;
- 'G' : Monitor := 'G'
- ELSE Monitor := 'M' ;
- END ;
- GotoXY(58,10) ;
- CASE Monitor OF
- 'C' : Write ('Color') ;
- 'G' : Write ('Graphics')
- ELSE Write ('Monochrome') ;
- END ; {end CASE Monitor}
- END ; {end IF Entry <> 13}
-
- GotoXY(2,12) ; Write ('Local telephone area code - ') ;
- GotoXY(58,12) ; Write (DefaultArea) ;
- GotoXY(32,12) ; Readln (Entry2) ;
- IF Entry2 <> '' THEN
- BEGIN
- AreaChanged := TRUE ;
- DefaultArea := Entry2 ;
- GotoXY(32,12) ; ClrEOL ;
- GotoXY(58,12) ; Write (DefaultArea) ;
- END ;
-
- GotoXY(2,14) ; Write ('Long distance access code - ') ;
- GotoXY(58,14) ; Write (Access) ;
- GotoXY(32,14) ; Readln (Entry3) ;
- IF Entry3 <> '' THEN
- BEGIN
- AccessChanged := TRUE ;
- Access := Entry3 ;
- GotoXY(32,14) ; ClrEOL ;
- GotoXY(58,14) ; Write (Access) ;
- END ;
-
- Gotoxy(2,16) ; Write ('Send form feeds to printer : (Y/N) - ') ;
- GotoXY(58,16) ;
- CASE FormFeed OF
- 'Y' : Write ('Form Feeds') ;
- 'N' : Write ('No Form Feeds') ;
- ELSE Write ('Set up error') ;
- END ; {end CASE FormFeed}
- GotoXY(40,16) ; Read (KBD,Entry) ; Entry := Upcase(Entry) ;
- IF Entry = #27 THEN GOTO 1 ;
- GotoXY(58,16) ; ClrEOL ;
- IF Entry <> #13 THEN
- BEGIN
- PrinterChanged := TRUE ;
- CASE Entry OF
- 'Y' : FormFeed := 'Y' ;
- ELSE FormFeed := 'N' ;
- END ;
- END ;
- GotoXY(58,16) ;
- CASE FormFeed OF
- 'Y' : Write ('Form Feeds') ;
- ELSE Write ('No Form Feeds') ;
- END ; {end CASE FormFeeds}
-
- Entry2 := '' ;
- GotoXY(2,18) ; Write ('Enter default data file name - ') ;
- GotoXY(58,18) ; Write (DiskFile) ;
- IF DataFile <> DiskFile THEN
- BEGIN
- GotoXY(50,20) ; Write ('( Data in use : ',DataFile,' )') ;
- END ;
- GotoXY(34,18) ; Readln (Entry2) ;
- __COffScn (TRUE) ;
- UpString (Entry2) ;
- IF Entry2 <> '' THEN
- BEGIN
- FileChanged := TRUE ;
- DataFile := Entry2 ;
- DiskFile := Entry2 ;
- GotoXY(34,18) ; ClrEOL ;
- GotoXY(58,18) ; Write (DataFile) ;
- END ;
- IF InitialConfig THEN FileChanged := TRUE ;
- IF FileChanged OR AreaChanged OR AccessChanged OR
- ScreenChanged OR PrinterChanged THEN
- BEGIN
- {$I-} RESET (Config) ; {$I+}
- OK := (IOResult = 0) ;
- IF NOT OK THEN
- BEGIN
- TextBackGround (Blue) ; TextColor (White+Blink) ;
- GotoXY(1,25) ; ClrEOL ;
- GotoXY(1,25) ; Write (' CARDEX.CFG IS NOT ON LOGGED DRIVE ') ;
- TextColor (White) ;
- Write ('- PRESS ANY KEY TO SAVE ONTO CURRENT DRIVE') ;
- Read (KBD,CharIn) ;
- END ;
- {$I-} CLOSE (Config) ; {$I+}
- REWRITE (Config) ;
- Writeln (Config,Monitor) ;
- Writeln (Config,DefaultArea) ;
- Writeln (Config,Access) ;
- Writeln (Config,FormFeed) ;
- Writeln (Config,DiskFile) ;
- CLOSE (Config) ;
- IF ScreenChanged THEN SetMonitor ;
- IF FileChanged AND Changed THEN SaveToDisk ;
- IF FileChanged THEN DataIn ;
- END ;
- 1 : __COffScn (TRUE) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE NewFile ;
-
- VAR
- OldDataFile,
- NewDataFile : STRING[12] ;
- CR : BOOLEAN ;
-
- BEGIN
- TempCard := MarkedCard^.Card ;
- OldDataFile := DataFile ;
- NewDataFile := '' ;
- IF Changed = TRUE THEN SaveToDisk ;
- TextColor (White) ; TextBackground (Red) ;
- GotoXY(1,25) ; ClrEOL ;
- GotoXY(71,25) ; Write (#17,#196,#217,' ABORT');
- GotoXY(1,25) ; Write (' Enter name of new CARDEX data file - ') ;
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- Read (NewDataFile) ;
- __COffScn (TRUE) ;
- UpString (NewDataFile) ;
- IF NewDataFile <> '' THEN
- BEGIN
- Current := Head ;
- WHILE Current <> Last DO
- BEGIN
- Current := Current^.NextNode ;
- Dispose (Current^.PrevNode) ;
- END ;
- Dispose (Current) ;
- DataFile := NewDataFile ;
- DataIn ;
- IF LoadFailed THEN
- BEGIN
- DataFile := OldDataFile ;
- DataIn ;
- END ;
- Current := Head ;
- END ;
- IF NewDataFile <> '' THEN DataToScreen ;
- TextColor (Yellow) ; TextBackground (Blue) ;
- GotoXY(1,25) ; ClrEOL ; GotoXY(1,25) ; Write (InfoLine) ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE PrintMenu ;
-
- VAR
- Cont : BOOLEAN ;
- Ch : CHAR ;
-
- BEGIN
- Cont := TRUE ;
- PrinterMode ; TextBackground (Grn) ;
- GotoXY(71,20) ; Window (71,19,80,24) ;
- Write (' F3 LABEL ') ;
- Write (' F5 ALL ') ;
- Write (' LABELS') ;
- Write (' F7 ALL ') ;
- Write (' CARDS ') ;
- Write (' F9 CARD ') ;
- Window (1,1,80,25) ;
- TextBackGround (Black) ;
- GotoXY(14,9) ;
- While Cont DO
- BEGIN
- InKey := GetKey (FunctionKey) ;
- IF FunctionKey THEN
- BEGIN
- Cont := FALSE ;
- CASE InKey OF
- '=' : BEGIN (* F3 single label *)
- PrintLabel ;
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- FunctionKeyInfo ;
- END ;
- '?' : BEGIN
- PrintAll ('L') ; (* F5 label format *)
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- END ;
- 'A' : BEGIN
- PrintAll ('C') ; (* F7 card format *)
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- END ;
- 'C' : BEGIN (* F9 single card *)
- PrintCard ;
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- FunctionKeyInfo ;
- END ;
- END ;
- END ;
- IF InKey = #27 THEN BEGIN Cont := FALSE ; Inkey := ' ' ; END ;
- END ;
- FunctionKeyInfo ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE DoFunctionCommand (FunctionKey : CHAR) ;
-
- BEGIN
- CASE FunctionKey OF
- 'H','M' : Next ; (* up/right cusor *)
- 'P','K' : Prev ; (* dn/left cusor *)
- 'I' : Adv4 ; (* page up *)
- 'Q' : Back4 ; (* page dn *)
- 'G' : HomeCard ; (* home *)
- 'O' : NewFile ; (* end *)
- ';' : BEGIN (* F1 *)
- Configure ; (* reconfigure *)
- Screen ; (* default file *)
- Current := Head ; (* and implement *)
- DataToScreen ; (* new defaults *)
- FunctionKeyInfo ; (* on the fly *)
- END ;
- '<' : Edit ('A') ; (* F2 add new entry *)
- '=' : BEGIN (* F3 *)
- PrintLabel ;
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- FunctionKeyInfo ;
- END ;
- '>' : GotoCard ; (* F4 *)
- '?' : BEGIN
- PrintAll ('L') ; (* F5 label format *)
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- END ;
- '@' : Edit ('E'); (* F6 edit entry *)
- 'A' : BEGIN
- PrintAll ('C') ; (* F7 card format *)
- IF FormFeed = 'Y' THEN Writeln (LST,#12) ;
- END ;
- 'B' : Delete ; (* F8 *)
- 'C' : PrintMenu ; (* F9 *)
- 'D' : SaveToDisk ; (* F10 *)
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE MarkCard ;
-
- BEGIN
- MarkedFile := DataFile ;
- MarkedCard := Current ;
- DataToScreen ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE TransferCard ;
-
- BEGIN
- NEW (Insert) ;
- Insert^.Card := TempCard ;
- Locate ;
- MarkedCard := Current ;
- MarkedFile := DataFile ;
- Changed := TRUE ;
- DataToScreen ;
- END ;
-
-
- (************************************************************************)
-
- PROCEDURE ReadConfiguration ;
-
- VAR
- OK : BOOLEAN ;
-
- BEGIN
- ASSIGN (Config,'CARDEX.CFG') ;
- {$I-} RESET (Config) ; {$I+}
- OK := (IOResult = 0) ;
- IF OK = TRUE THEN
- BEGIN
- Readln (Config,Monitor) ;
- Readln (Config,DefaultArea) ;
- Readln (Config,Access) ;
- Readln (Config,FormFeed) ;
- Readln (Config,DiskFile) ;
- DataFile := DiskFile ;
- CLOSE (Config) ;
- END ;
- SetMonitor ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE PrintDocumentation ;
-
- VAR
- Ch : CHAR ;
- DocFile : TEXT ;
- OK : BOOLEAN ;
-
- BEGIN
- ASSIGN (DocFile,'CARDEX.DOC') ;
- {$I-} RESET (DocFile) ; {$I+}
- OK := (IOResult = 0) ;
- IF OK = TRUE THEN
- BEGIN
- WHILE NOT EOF (DocFile) DO
- BEGIN
- READ (DocFile,Ch) ; WRITE (Ch) ;
- END ;
- CLOSE (DocFile) ;
- END ELSE
- BEGIN
- Writeln ('CARDEX.DOC FILE NOT AVAILABLE ON CURRENT DISK/DIRECTORY') ;
- DELAY (5000) ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE OpeningScreen ;
-
- CONST
- X = 37 ;
-
- LABEL 1 ;
-
- VAR
- Entry : STRING[12] ;
- CharIn : CHAR ;
- KeyOK, Continue : BOOLEAN ;
- Pos, Code : INTEGER ;
-
- BEGIN
- IF Length(ParamStr(1)) > 0 THEN
- BEGIN
- IF ParamStr(1) = ('?') THEN
- BEGIN PrintDocumentation ; Abort := TRUE ; GOTO 1 ; END ;
- IF ParamStr(1) <> ('*') THEN DataFile := ParamStr(1) ;
- DataIn ; GOTO 1 ;
- END ;
- NormVideo ; TextBackGround(Blu) ; TextColor(White) ; ClrScr ;
- FOR Counter := 1 TO 80 DO Write (#205) ;
- Writeln (' CARDEX by Carson Information Services') ;
- Writeln ;
- Write (' ',Copyright) ;
- Writeln (' Version ',Version,' P/N') ;
- Writeln ;
- Write (' Program CARDEX.COM') ;
- Write (' Configuration CARDEX.CFG') ;
- Writeln (' Documentation CARDEX.DOC') ;
- Writeln ;
- FOR Counter := 1 TO 80 DO Write (#205) ;
- GotoXY(1,12) ; FOR Counter := 1 TO 80 DO Write (#205) ;
- GotoXY(21,13) ;
- Window (21,13,80,24) ;
- Writeln (' M : MARK A CARD FOR TRANSFER TO ANOTHER FILE') ;
- Writeln (' T : TRANSFER (COPY) MARKED CARD TO CURRENT FILE') ;
- Writeln (' F1 : CONFIGURE CARDEX SYSTEM') ;
- Writeln (' F2 : ADD A NEW CARD TO FILE') ;
- Writeln (' F3 : PRINT SINGLE ADDRESS LABEL') ;
- Writeln (' F4 : GOTO - SELECT CARD TO ADVANCE TO') ;
- Writeln (' F5 : PRINT ADDRESS LABELS') ;
- Writeln (' F6 : EDIT CURRENT CARD') ;
- Writeln (' F7 : PRINT CONTENTS OF CARDEX FILE') ;
- Writeln (' F8 : DELETE CURRENT CARDEX CARD') ;
- Writeln (' F9 : PRINT SUBMENU / PRINT CURRENT CARD') ;
- Write ('F10 : MANUALLY SAVE FILE TO DISK') ;
- Window (1,1,80,25) ;
- GotoXY(1,25) ; FOR Counter := 1 TO 79 DO Write (#205) ;
- GotoXY(1,10) ; Write (' ENTER CARDEX DATA FILE TO BE USED - ') ;
- Writeln (' (Default file is ',DataFile,')') ;
- GotoXY(38,10) ;
- Ch := #32 ; Ch2 := #32 ; Pos := 1 ;
- Continue := TRUE ;
- Entry := ' ' ;
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- While Continue DO
- BEGIN
- Read (KBD,Ch) ;
- KeyCheck ;
- CASE Key OF
- Regular : BEGIN
- Write (Ch) ;
- Entry[Pos] := Ch ;
- IF Pos < 12
- THEN Pos := Pos + 1
- ELSE GotoXY(X+Pos,10) ;
- END ;
- Return : IF Entry[1] = #32
- THEN BEGIN
- DataIn ; Continue := FALSE ;
- END
- ELSE BEGIN
- DataFile := Entry ;
- UpString (DataFile) ;
- DataIn ; IF LoadFailed THEN GOTO 1 ;
- Continue := FALSE ;
- END ;
- BackSpace : IF Pos > 1
- THEN BEGIN
- Pos := Pos - 1 ;
- GotoXY(X+Pos,10) ;
- Entry[Pos] := #32 ;
- Write (Entry[Pos]) ;
- GotoXY(X+Pos,10) ;
- END ;
- Cursor : CASE CursorDir OF
- Left : BEGIN
- IF Pos > 1 THEN
- BEGIN
- Pos := Pos - 1 ;
- GotoXY(X+Pos,10) ;
- END ;
- END ;
- Right : BEGIN
- IF Pos < 12 THEN
- BEGIN
- Pos := Pos + 1 ;
- GotoXY(X+Pos,10) ;
- END ;
- END ;
- END ;
- F1 : BEGIN
- InitialConfig := TRUE ;
- DataIn ;
- Continue := FALSE ;
- END ;
- Escape : BEGIN Abort := TRUE ; Continue := FALSE ; END ;
- END ; (* end case key *)
- END ; (* end while continue *)
- 1 : __COffScn (TRUE) ;
- END ; (* end procedure opening screen *)
-
- (************************************************************************)
-
- PROCEDURE Cardex ;
-
- BEGIN
- __COffScn (TRUE) ;
- Screen ;
- JustStarted := FALSE ;
- Current := Head ;
- ThisCard := Current^.Card ;
- IF NOT Abort THEN DataToScreen ;
- FunctionKeyInfo ;
- While Abort = FALSE DO
- BEGIN
- IF EntryGotoCard THEN DoFunctionCommand ('>') ELSE
- BEGIN
- InKey := GetKey (FunctionKey) ;
- IF FunctionKey THEN DoFunctionCommand (InKey)
- ELSE CASE CharIn OF
- 'M' : MarkCard ;
- 'T' : IF MarkedFile <> DataFile THEN TransferCard ;
- END ;
- IF InKey = #27 THEN Abort := TRUE ;
- END ;
- END ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE SetCoordinates ;
-
- VAR Pos : INTEGER ;
-
- BEGIN
- FOR FldNbr := 1 TO 5 DO Fld[FldNbr].Y := 1 ;
- Fld[1].X := 1 ; Fld[2].X := 20 ; Fld[3].X := 41 ;
- Fld[4].X := 46 ; Fld[5].X := 50 ;
- Fld[6].X := 1 ; Fld[6].Y := 2 ;
- FOR FldNbr := 7 TO 10 DO Fld[FldNbr].Y := 3 ;
- Fld[7].X := 1 ; Fld[8].X := 28 ; Fld[9].X := 31 ; Fld[10].X := 37 ;
- Fld[1].Len := 19 ; Fld[2].Len := 15 ;
- Fld[3].Len := 3 ; Fld[4].Len := 3 ;
- Fld[5].Len := 4 ; Fld[6].Len := 54 ;
- Fld[7].Len := 26 ; Fld[8].Len := 2 ;
- Fld[9].Len := 5 ; Fld[10].Len := 4 ;
- FOR FldNbr := 11 TO 15 DO
- BEGIN
- Fld[FldNbr].X := 1 ; Fld[FldNbr].Y := FldNbr - 6 ;
- Fld[FldNbr].Len := 54 ;
- END ;
- FOR FldNbr := 1 TO 15 DO
- FOR Pos := 1 TO Fld[FldNbr].Len DO Fld[FldNbr].Str[Pos] := #32 ;
- TempFld := Fld ;
- Prompt[1] := '( Last name )' ;
- Prompt[2] := '( First name )' ;
- Prompt[3] := '( Area code )' ;
- Prompt[4] := '( Phone exchange - 3 digits )' ;
- Prompt[5] := '( Phone - last 4 digits ) ' ;
- Prompt[6] := '( Street address or P.O. Box )' ;
- Prompt[7] := '( City )' ;
- Prompt[8] := '( State - 2 letter code )' ;
- Prompt[9] := '( ZIP - 5 digits )' ;
- Prompt[10] := '( Extended ZIP - 4 digits )' ;
- FOR Counter := 11 TO 15 DO
- Prompt[Counter] := '( Additional information )' ;
- END ;
-
- (************************************************************************)
-
- PROCEDURE BuildCopyRight ;
-
- BEGIN
- Copyright := ' ' ;
- Copyrite[1] := 67 ; Copyrite[16] := 32 ; Copyrite[25] := 115 ;
- Copyrite[2] := 111 ; Copyrite[17] := 77 ; Copyrite[26] := 111 ;
- Copyrite[3] := 112 ; Copyrite[18] := 97 ; Copyrite[27] := 110 ;
- Copyrite[4] := 121 ; Copyrite[19] := 114 ; Copyrite[10] := 32 ;
- Copyrite[5] := 114 ; Copyrite[20] := 107 ; Copyrite[11] := 49 ;
- Copyrite[6] := 105 ; Copyrite[21] := 32 ; Copyrite[12] := 57 ;
- Copyrite[7] := 103 ; Copyrite[22] := 67 ; Copyrite[13] := 56 ;
- Copyrite[8] := 104 ; Copyrite[23] := 97 ; Copyrite[14] := 54 ;
- Copyrite[9] := 116 ; Copyrite[24] := 114 ;
- Copyrite[15] := 44 ;
- FOR Pos := 1 TO 27 DO
- Copyright[Pos] := CHR (Copyrite[Pos]) ;
- END;
-
- (******************** START OF MAIN CONTROL ROUTINE *********************)
-
- BEGIN
- Top := 6 ; Bottom := 7 ;
- __COffScn (TRUE) ;
- BuildCopyright ;
- IF ParamCount >= 2
- THEN EntryGotoCard := TRUE
- ELSE EntryGotoCard := FALSE ;
- Abort := FALSE ;
- Changed := FALSE ;
- LoadFailed := FALSE ;
- JustStarted := TRUE ;
- InitialConfig := FALSE ;
- Monitor := 'M' ; DefaultArea := '808' ; FormFeed := 'N' ; Access := '1-' ;
- DataFile := 'CARDEX.DAT' ; DiskFile := '' ;
- InfoLine := ' '+CHR(18)+' NEXT/PREV PgUp/PgDn ADV/BACK 4 Home FIRST CARD End NEW FILE Esc EXIT ' ;
- TextBackground (Black) ;
- ClrScr ;
- AuthorsCard ;
- ReadConfiguration ;
- SetCoordinates ;
- OpeningScreen ;
- IF InitialConfig THEN Configure ;
- IF LoadFailed THEN Abort := TRUE ;
- IF NOT Abort THEN
- BEGIN
- Cardex ;
- IF Changed = TRUE THEN SaveToDisk ;
- END ;
- TextBackGround (Black) ; TextColor ( White) ;
- ClrScr ; TextColor (Black) ; TextBackGround (Black) ; GotoXY (1,1) ;
- Write ('CARDEX ',Copyright) ;
- Write ('- Compiled ',CompileDate) ;
- TextColor (White) ;
- __COffScn (FALSE) ;
- __CSizeScn (Top,Bottom) ;
- END. (* END OF PROGRAM *)
-
- (*********************** END OF PROGRAM "CARDEX" ************************)